package cn.afactory.tygz.model;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created with Android Studio.
 * Title:BooleanResult
 * Description:
 * Copyright:Copyright (c) 2014
 * Company:中国平安健康保险有限公司
 * Author:Alice
 * Date:15/9/9
 * Time:下午5:26
 * Version 1.0
 */
public class BooleanResult extends BaseDataHeader {
    private static final long serialVersionUID = -2918740204699591848L;
    public static BooleanResult deserialize(String json) throws JSONException {
        if (json != null && !json.isEmpty()) {
            return deserialize(new JSONObject(json));
        }
        return null;
    }

    public static BooleanResult deserialize(JSONObject json) throws JSONException {
        if (json != null && json != JSONObject.NULL && json.length() > 0) {
            BooleanResult result = new BooleanResult();

            result.message = json.optString("message");
            result.state = json.optInt("state");

            return result;
        }
        return null;
    }
}
